   $(document).ready(function() {
  // 资讯推荐轮播
  jQuery('.xj-lb-tt .lb-tt-item').simpleSwitch1({
    prev: '.xj-lb-tt .lb-tt-btn .prev',
    next: '.xj-lb-tt .lb-tt-btn .next',
    playTime: 2000,
    type: 'top'
  })
});
    (function($) {
        function simpleSwitch1(option) {
            var $banner = option._this,
                $text = option.text ? $(option.text) : null,
                $prev = option.prev ? $(option.prev) : null,
                $next = option.next ? $(option.next) : null,
                $num = option.num ? $(option.num) : null,
                $indy = option.indy ? $(option.indy) : null,
                $lendy = option.lendy ? $(option.lendy) : null,
                callBack = option.callback;
            var len = $banner.length,
                index = option.index || 0,
                time = option.time || 300,
                playTime = option.playTime || 4000,
                type = option.type || 'left',
                direction = option.direction || 'next',
                autoPlay =
                option.autoPlay === undefined || option.autoPlay === true ?
                true :
                false,
                className = option.className || 'cur';
            type = type === 'top' ? 'top' : 'left';
            var winWidth = $(window).width();
            if (winWidth < 480) {
                var size = winWidth / 1200;
            } else {
                var size = 1;
            }
            var pw =
                type === 'top' ?
                $banner.parent().height():
                $banner.parent().width(),
                cw = type === 'top' ? $banner.height() : $banner.parent().width();
            option.space = option.space || 0;
            cw += option.space;
            var css = {};
            if (cw * len <= pw) return;
            init();

            function init() {
                if ($lendy) {
                    $lendy.text(len);
                }
                $banner.each(function() {
                    var _i = $(this).index();
                    $(this).show();
                    css[type] = (_i - index) * cw;
                    $(this).css(css);
                });
                if ($num) {
                    $num.eq(index)
                        .addClass(className)
                        .siblings()
                        .removeClass(className);
                }
                if ($indy) {
                    $indy.text(index + 1);
                }
                if ($text) {
                    $text
                        .eq(index)
                        .show(0)
                        .siblings()
                        .hide();
                }
            }

            function nextMove() {
                if (!$banner.is(':visible')) return;
                for (var i = 0; i < len; i++) {
                    var $item = $banner.eq(i);
                    var pos = Math.floor($item.position()[type] / size);
                    if (pos <= -cw) {
                        var perLeft = 0;
                        if (i === 0) {
                            perLeft = $banner.eq(len - 1).position()[type] / size;
                        } else {
                            perLeft = $banner.eq(i - 1).position()[type] / size;
                        }
                        css[type] = perLeft + cw;
                        $item.css(css);
                    }
                    var nowLeft = Math.round($item.position()[type] / size);
                    css[type] = nowLeft - cw;
                    $item.animate(css, time);
                }
            }

            function prevMove() {
                if (!$banner.is(':visible')) return;
                for (var i = 0; i < len; i++) {
                    var $item = $banner.eq(i);
                    var pos = Math.floor($item.position()[type] / size);
                    if (pos >= pw) {
                        var perLeft = 0;
                        if (i === len - 1) {
                            perLeft = $banner.eq(0).position()[type] / size;
                        } else {
                            perLeft = $banner.eq(i + 1).position()[type] / size;
                        }
                        css[type] = perLeft - cw;
                        $item.css(css);
                    }
                    var nowLeft = Math.round($item.position()[type] / size);
                    css[type] = nowLeft + cw;
                    $item.animate(css, time);
                }
            }

            function bannerPlay() {
                if ($banner.is(':animated')) return;
                index++;
                index = index >= len ? 0 : index;
                if (direction === 'next') {
                    nextMove();
                } else {
                    prevMove();
                }
                toNextShow();
            }
            if (autoPlay) {
                var play = setInterval(bannerPlay, playTime);
            }

            function toNextShow() {
                if ($num) {
                    if (direction === 'next') {
                        $num.eq(index)
                            .addClass(className)
                            .siblings()
                            .removeClass(className);
                    } else {
                        $num.eq(len - index)
                            .addClass(className)
                            .siblings()
                            .removeClass(className);
                    }
                }
                if ($text) {
                    if (direction === 'next') {
                        $text
                            .eq(index)
                            .show(0)
                            .siblings()
                            .hide();
                    } else {
                        $text
                            .eq(len - index)
                            .show(0)
                            .siblings()
                            .hide();
                    }
                }
                if ($indy) {
                    if (direction === 'next') {
                        $indy.text(index + 1);
                    } else {
                        $indy.text(len - index + 1);
                    }
                }
                if (!autoPlay) return;
                clearInterval(play);
                play = null;
                play = setInterval(bannerPlay, playTime);
                if (callBack) callBack();
            }
            if ($next) {
                $next.click(function() {
                    if ($banner.is(':animated')) return;
                    index--;
                    index = index < 0 ? len - 1 : index;
                    // 12.10娣囶喗鏁�
                    prevMove();
                    toNextShow();
                });
            }
            if ($prev) {
                $prev.click(function() {
                    if ($banner.is(':animated')) return;
                    index++;
                    index = index >= len ? 0 : index;
                    // 12.10娣囶喗鏁�
                    nextMove();
                    toNextShow();
                });
            }
            if ($num) {
                $num.mouseenter(function() {
                    if ($banner.is(':animated')) return;
                    var nextIndex = $num.index($(this));
                    $banner.each(function() {
                        var _i = $(this).index();
                        $(this).show();
                        css[type] = (_i - index) * cw;
                        $(this).css(css);
                    });
                    for (var i = 0; i < len; i++) {
                        var $item = $banner.eq(i);
                        var nowLeft = $item.position()[type];
                        css[type] = nowLeft + -cw * (nextIndex - index);
                        $item.animate(css, time);
                    }
                    index = nextIndex;
                    toNextShow();
                });
            }
        }

        $.fn.extend({
            simpleSwitch1: function(option) {
                var opt = option || {};
                opt._this = $(this);
                simpleSwitch1(opt);
            }
        });
    })(jQuery);

    if (typeof exports === 'object') {
        module.exports = jQuery;
    }